package com.hp.bon.sgw.domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "SGW_CAPABILITY_ABN_LMT_CFG")
public class CapabilityAbnLmtCfg {
	
	private String capability;
	private long period;
	private int limitUnitType;
	private long limitValue;
	private long rejectPerc;
	private Set<Integer> rcSet = new HashSet<Integer>();
	private Set<Integer> resultCodeSet = new HashSet<Integer>();
	private Set<Integer> serviceResultCodeSet = new HashSet<Integer>();
	
	public void putRc(Integer rc)
	{
		rcSet.add(rc);
	}
	
	public void putResultCode(Integer resultCode)
	{
		resultCodeSet.add(resultCode);
	}
	
	public void putServiceResultCode(Integer serviceResultCode)
	{
		serviceResultCodeSet.add(serviceResultCode);
	}
	
	public boolean containRC(Integer rc)
	{
		return rcSet.contains(rc);
	}
	
	public boolean containResultCode(Integer resultCode)
	{
		return resultCodeSet.contains(resultCode);
	}
	
	public boolean containServiceResultCode(Integer serviceResultCode)
	{
		return serviceResultCodeSet.contains(serviceResultCode);
	}	
	
	
	@Id
	@Column(name = "CAPABILITY")
	public String getCapability() {
		return capability;
	}
	
	public void setCapability(String capability) {
		this.capability = capability;
	}
	
	@Column(name = "PERIOD")
	public long getPeriod() {
		return period;
	}
	public void setPeriod(long period) {
		this.period = period;
	}
	
	@Column(name = "LIMIT_UNIT_TYPE")
	public int getLimitUnitType() {
		return limitUnitType;
	}

	public void setLimitUnitType(int limitUnitType) {
		this.limitUnitType = limitUnitType;
	}

	@Column(name = "LIMIT_VALUE")
	public long getLimitValue() {
		return limitValue;
	}
	public void setLimitValue(long limitValue) {
		this.limitValue = limitValue;
	}
	
	@Column(name = "REJECT_PERC")
	public long getRejectPerc() {
		return rejectPerc;
	}
	public void setRejectPerc(long rejectPerc) {
		this.rejectPerc = rejectPerc;
	}

	@Transient
	public String toString() {
		return this.capability + "|" + this.period + "|" + this.limitUnitType+"|"+this.limitValue+"|"+this.rejectPerc;
	}

}
